<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/core" prefix="c"%>
<%@ taglib uri="/tags/fmt" prefix="fmt"%>
<%@page import="com.cs.common.utils.NumberUtil"%>
<script type="text/javascript">
function changeValue(element){
	if( element.checked ){
		element.value = 1;
	}else{
		element.value = 0;
	}
}
</script>
<html:form action="/saveGrindDistributionVersion">
	<table width="<bean:write name="totalSizeWithCorn"/>" align="left" border="0">
		<tr>
			<td style="width: 100%" align="center">
				<table width="100%" align="center" border="0" cellspacing="1" bgcolor="#CCCCC0">
					<logic:present name="GrindDistributionVersionForm" property="grindDistributionVersion">
						<logic:iterate name="GrindDistributionVersionForm" property="grindDistributionVersion"  id="plants" indexId="externalCount">
							<tr class="<%=((externalCount.intValue()%2)==0?"columnadatoPar":"columnadatoNon")%>">
								<td width="147">
									<table width="100%" align="center" border="0" cellspacing="0" bgcolor="#CCCCC0">
										<tr class="<%=((externalCount.intValue()%2)==0?"columnadatoPar":"columnadatoNon")%>">
											<td rowspan="3" width="50%">
												<bean:write name="plants" property="shortName"/>
											</td>
											<td height="20">
												<bean:message key="label.plants.add.column.grind.priority"/>
											</td>
										</tr>
										<tr class="<%=((externalCount.intValue()%2)==0?"columnadatoPar":"columnadatoNon")%>">
											<td height="20">
												<bean:message key="label.plants.add.column.max.unload.short"/>
											</td>
										</tr>
										<tr class="<%=((externalCount.intValue()%2)==0?"columnadatoPar":"columnadatoNon")%>">
											<td height="20">
												<bean:message key="label.plants.add.column.fixed"/>
											</td>
										</tr>
									</table>
								</td>
								<logic:iterate name="plants" property="grindDistributionVersionCornTypeViews" id="months" indexId="internalCount">
									<td>
										<input value="<bean:write name="months" property="priority"/>" type="text" id="priority" size="8" name="grindDistributionVersion[<%=externalCount.intValue()%>].grindDistributionVersionCornTypeViews[<%=internalCount.intValue()%>].priority" class="columnanumero" onfocus="this.select();" onkeydown="return (numeric(event, 0) && noPaste(event, this));" onkeyup="extractNumber(this,0,false);"/><br/>
										<input value="<bean:write name="months" property="unloadAmount"/>" type="text" id="unloadAmounts" size="8" name="grindDistributionVersion[<%=externalCount.intValue()%>].grindDistributionVersionCornTypeViews[<%=internalCount.intValue()%>].unloadAmount" class="columnanumero" onfocus="this.select();" onkeydown="return (numeric(event, 1) && noPaste(event, this));" onkeyup="extractNumber(this,4,false);"/><br/>
										<bean:define id="fixedValue"><bean:write name="months"  property="fixed"/></bean:define>
										<input <%=(fixedValue.equals("1")?"checked":"")%> value="<bean:write name="months" property="fixed"/>" type="checkbox" id="fixed" name="grindDistributionVersion[<%=externalCount.intValue()%>].grindDistributionVersionCornTypeViews[<%=internalCount.intValue()%>].fixed" onclick="changeValue(this);"/><br/>
									</td>
								</logic:iterate>
							</tr>
						</logic:iterate>
					</logic:present>
					<tr>
						<td align="left" colspan="<bean:write name="totalPeriodsWithCorn"/>" height="30" class="etiqueta_campo">
							&nbsp;&nbsp;&nbsp;&nbsp;<html:submit styleClass="boton"><bean:message key="label.common.save"/></html:submit>
							<html:button property="cancel" onclick="location.href = 'showVersionDetail.do'" styleClass="boton"><bean:message key="label.common.cancel"/></html:button>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</html:form>